package com.xiangxiao.rpan.settings;

import com.xiangxiao.rpan.settings.factory.ApplicationContextFactory;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
/**
 * @auther xiangxiao
 * @email 573768011@qq.com
 * @data 2023/6/9 11:39
 */
@SpringBootApplication(scanBasePackages = "com.xiangxiao.rpan.settings", exclude = {FlywayAutoConfiguration.class, DataSourceAutoConfiguration.class})
@Configuration
//@EnableEurekaClient
@EnableFeignClients
@MapperScan("com.xiangxiao.rpan.settings.dao")
@Slf4j
public class Application {
    private static Logger logger = LoggerFactory.getLogger(Application.class);
    public static void main(String[] args) throws Exception {
        try {
            ApplicationContext context = SpringApplication.run(Application.class, args);
            // 给ApplicationContextFactory的私有属性applicationContext赋值---Spring Ioc容器上下文
            ApplicationContextFactory.setApplicationContext(context);
        } catch (Throwable e) {
            logger.error("系统启动失败", e);
        }
    }

}
